import { type PluginManager } from '/@/views/formDesigner/utils';
import MonacoEditor from './MonacoEditor';
import Page from './Page';
import ButtonBtn from '../../ui/cloud/common/buttonBtn';
import LenSize from '../../ui/cloud/common/lenSize';
import CalcInput from '../../ui/cloud/common/calcInput';
import MacroIconCtl from '../../ui/cloud/common/macroIconCtl';
import MacroFormulaCtl from '../../ui/cloud/common/macroFormulaCtl';
import NestSheet from '../../ui/cloud/common/nestSheet';
import ModuleFieldSelect from '../../ui/cloud/common/moduleFieldSelect';

export async function setupComponent(pluginManager: PluginManager) {
  pluginManager.component('ETabPaneEditor', async () => await import('./ETabPaneEditor/index.vue'));
  pluginManager.component('EInputSize', async () => await import('./EInputSize/index.vue'));
  pluginManager.component('EInputSize2', async () => await import('./EInputSize2/index.vue'));
  pluginManager.component('EColEditor', async () => await import('./EColEditor/index.vue'));
  pluginManager.component('EActionEditor', async () => await import('./EActionEditor/index.vue'));
  pluginManager.component('ERuleEditor', async () => await import('./ERuleEditor/index.vue'));
  pluginManager.component('EOptionsEditor', async () => await import('./EOptionsEditor/index.vue'));
  pluginManager.component('ENode', async () => await import('../components/node/index'));

  const componentArray = [
    MonacoEditor,
    Page,
    LenSize,
    CalcInput,
    MacroIconCtl,
    MacroFormulaCtl,
    NestSheet,
    ModuleFieldSelect,
    ButtonBtn,
  ];

  componentArray.forEach((item) => {
    pluginManager.registerComponent(item);
  });
  // 左侧菜单初始化
  pluginManager.registerActivitybar({
    id: 'component_view',
    title: '组件',
    icon: 'epic-icon-mokuai_1',
    component: async () =>
      await import('../components/designer/src/modules/componentView/index.vue'),
  });

  pluginManager.registerActivitybar({
    id: 'sound_code_view',
    title: '源码',
    icon: 'epic-icon-daima1',
    component: async () => await import('../components/designer/src/modules/soundCode/index.vue'),
  });

  pluginManager.registerActivitybar({
    id: 'outline_view',
    title: '大纲',
    icon: 'epic-icon-juxingkaobei',
    component: async () => await import('../components/designer/src/modules/outline/outline.vue'),
  });

  pluginManager.registerRightSidebar({
    id: 'attribute_view',
    title: '属性',
    component: async () =>
      await import('../components/designer/src/modules/attributeView/attributeView.vue'),
  });

  pluginManager.registerRightSidebar({
    id: 'style_view',
    title: '样式',
    component: async () =>
      await import('../components/designer/src/modules/attributeView/styleView.vue'),
  });
  // pluginManager.registerRightSidebar({
  //   id: 'event_view',
  //   title: '事件',
  //   component: async () =>
  //     await import('../components/designer/src/modules/attributeView/eventView.vue'),
  // });
}
